var t = getApp();
Component({
  properties: {
    color: { type: String, value: '#000' },
    bcolor: { type: String, value: '#fff' },
    title: { type: String, value: '' },
    rightIcon: { type: String, value: '' },
    jumpType: { type: String, value: 'navigateTo' },
    jumpUrl: { type: String, value: '' },
    bg: { type: String, value: '' },
    scrollTop: { type: Number, value: 0 },
    fixed: { type: Boolean, value: !1 },
    hijackBack: { type: Boolean, value: !1 },
    hideLeft: { type: Boolean, value: !1 },
  },
  data: { statusBarHeight: 40, navBarHeight: 86, pageLength: 0 },
  attached: function () {
    var e = getCurrentPages();
    this.setData({
      pageLength: e.length,
      statusBarHeight: t.globalData.statusBarHeight,
      navBarHeight: t.globalData.navBarHeight,
    });
  },
  observers: {
    scrollTop: function (t) {
      this.setData({
        _navBg: 'rgba(255,255,255,'.concat(t / 150 > 1 ? 1 : t / 150, ')'),
        _navColor: 'rgb('
          .concat(255 - (255 * t) / 150 < 32 ? 32 : 255 - (255 * t) / 150, ', ')
          .concat(255 - (255 * t) / 150 < 32 ? 32 : 255 - (255 * t) / 150, ', ')
          .concat(255 - (255 * t) / 150 < 32 ? 32 : 255 - (255 * t) / 150, ')'),
      });
    },
  },
  methods: {
    _back: function () {
      this.properties.hijackBack
        ? this.triggerEvent('back')
        : wx.navigateBack({ delta: 1 });
    },
    _home: function () {
      this.properties.hijackBack
        ? this.triggerEvent('back')
        : wx.switchTab({ url: '/pages/index/index' });
    },
    _jumpTo: function (t) {
      var e = this.properties.jumpType,
        a = this.properties.jumpUrl;
      a
        ? (console.log(e), wx[e]({ url: a }))
        : this.triggerEvent('rightTap', t);
    },
  },
});
